﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using OperationPlugins.Validators.DataAnnotations;

namespace Demo.Model
{
    [OmaTable("Employee", Schema = "OperationPluginsDemo")]
    [UsePluginValidators]
    public class Employee
    {
        /// <summary>
        /// Id
        /// </summary>
        [Key]
        [Required]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Display(Name = "#")]
        public int EmployeeId { set; get; }

        /// <summary>
        /// Last name
        /// </summary>
        [Required(AllowEmptyStrings = false)]
        [StringLength(100)]
        [Display(Name = "Last name")]
        public string LastName { set; get; }

        /// <summary>
        /// First name
        /// </summary>
        [Required(AllowEmptyStrings = false)]
        [StringLength(100)]
        [Display(Name = "First name")]
        public string FirstName { set; get; }

        /// <summary>
        /// Title of courtesy
        /// </summary>
        [StringLength(100)]
        [Display(Name = "Title of courtesy")]
        public string TitleOfCourtesy { set; get; }

        /// <summary>
        /// Title
        /// </summary>
        [Required(AllowEmptyStrings = false)]
        [StringLength(100)]
        [Display(Name = "Title")]
        public string Title { set; get; }

        /// <summary>
        /// Birth date
        /// </summary>
        [Required]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
        [Display(Name = "Birth date")]
        public DateTime BirthDate { set; get; }
     
        /// <summary>
        /// Hire date
        /// </summary>
        [Required]
        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
        [Display(Name = "Hire date")]
        public DateTime HireDate { set; get; }

        /// <summary>
        /// Salary (per year)
        /// </summary>
        [Range(0, double.MaxValue)]
        [Display(Name = "Salary (€)")]
        public decimal Salary { set; get; }

        /// <summary>
        /// Annual bonus
        /// </summary>
        [Range(0, double.MaxValue)]
        [Display(Name = "Annual bonus (€)")]
        public decimal AnnualBonus { set; get; }

        /// <summary>
        /// Company e-mail address
        /// </summary>
        [Required]
        [StringLength(100)]
        [Display(Name = "Company e-mail")]
        public string CompanyEmail { set; get; }

        /// <summary>
        /// Company network username
        /// </summary>
        [StringLength(32)]
        [Display(Name = "Company network username")]
        public string CompanyNetworkUsername { set; get; }

        /// <summary>
        /// Company network password
        /// </summary>
        [StringLength(32)]
        [Display(Name = "Company network password")]
        public string CompanyNetworkPassword { set; get; }
    }
}
